/*  1:   */ package org.jetbrains.rsa;
/*  2:   */ 
/*  3:   */

import com.intellij.licensecommon.util.a;

import java.math.BigInteger;

/*  4:   */
/*  5:   */ 
/*  6:   */ public class GroupUtil
/*  7:   */ {
/*  8:   */   public static String encodeGroups(BigInteger paramBigInteger)
/*  9:   */   {
/* 10:13 */     BigInteger localBigInteger = BigInteger.valueOf(60466176L);
/* 11:14 */     StringBuffer localStringBuffer = new StringBuffer();
/* 12:15 */     int i = 0;
/* 13:16 */     while (paramBigInteger.compareTo(BigInteger.ZERO) != 0)
/* 14:   */     {
/* 15:17 */       int j = paramBigInteger.mod(localBigInteger).intValue();
/* 16:18 */       String str2 = encodeGroup(j);
/* 17:19 */       if (i > 0) {
/* 18:20 */         localStringBuffer.append("-");
/* 19:   */       }
/* 20:22 */       localStringBuffer.append(str2);
/* 21:23 */       paramBigInteger = paramBigInteger.divide(localBigInteger);
/* 22:24 */       i++;
/* 23:   */     }
/* 24:26 */     String str1 = localStringBuffer.toString();
/* 25:27 */     return str1;
/* 26:   */   }
/* 27:   */   
/* 28:   */   public static String encodeGroup(int paramInt)
/* 29:   */   {
/* 30:31 */     StringBuffer localStringBuffer = new StringBuffer();
/* 31:32 */     int i = 36;
/* 32:33 */     for (int j = 0; j < 5; j++)
/* 33:   */     {
/* 34:34 */       int k = paramInt % 36;
/* 35:   */       char c;
/* 36:36 */       if (k < 10) {
/* 37:37 */         c = (char)(48 + k);
/* 38:   */       } else {
/* 39:40 */         c = (char)(65 + k - 10);
/* 40:   */       }
/* 41:42 */       localStringBuffer.append(c);
/* 42:43 */       paramInt /= 36;
/* 43:   */     }
/* 44:45 */     return localStringBuffer.toString();
/* 45:   */   }
/* 46:   */   
/* 47:   */   public static BigInteger decodeGroups(String paramString)
/* 48:   */     throws a
/* 49:   */   {
/* 50:49 */     BigInteger localBigInteger1 = BigInteger.ZERO;
/* 51:50 */     int i = paramString.length();
/* 52:51 */     BigInteger localBigInteger2 = BigInteger.valueOf(60466176L);
/* 53:52 */     while (i >= 0)
/* 54:   */     {
/* 55:53 */       int j = paramString.lastIndexOf('-', i - 1) + 1;
/* 56:   */       
/* 57:55 */       String str = paramString.substring(j, i);
/* 58:56 */       int k = decodeGroup(str);
/* 59:57 */       localBigInteger1 = localBigInteger1.multiply(localBigInteger2);
/* 60:58 */       localBigInteger1 = localBigInteger1.add(BigInteger.valueOf(k));
/* 61:   */       
/* 62:60 */       i = j - 1;
/* 63:   */     }
/* 64:62 */     return localBigInteger1;
/* 65:   */   }
/* 66:   */   
/* 67:   */   public static int decodeGroup(String paramString)
/* 68:   */     throws a
/* 69:   */   {
/* 70:66 */     if (paramString.length() != 5) {
/* 71:67 */       throw new a();
/* 72:   */     }
/* 73:70 */     int i = 36;
/* 74:71 */     int j = 0;
/* 75:72 */     for (int k = paramString.length() - 1; k >= 0; k--)
/* 76:   */     {
/* 77:73 */       int m = paramString.charAt(k);
/* 78:   */       int n;
/* 79:76 */       if ((48 <= m) && (m <= 57)) {
/* 80:77 */         n = m - 48;
/* 81:79 */       } else if ((65 <= m) && (m <= 90)) {
/* 82:80 */         n = m - 65 + 10;
/* 83:   */       } else {
/* 84:83 */         throw new a();
/* 85:   */       }
/* 86:86 */       j *= 36;
/* 87:87 */       j += n;
/* 88:   */     }
/* 89:90 */     return j;
/* 90:   */   }
/* 91:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.rsa.GroupUtil

 * JD-Core Version:    0.7.0.1

 */